<template>
	<view class="page">
		<view class="wrapper">
			<form>
				<view class="cu-form-group">
					<view class="title">类型</view>
					<picker @change="PickerChange" :value="index" :range="picker">
						<view class="picker">
							{{index>-1?picker[index]:'请选择'}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group">
					<view class="title">姓名</view>
					<input class="ipt" placeholder="请输入" name="input"></input>
				</view>
				<view class="cu-form-group">
					<view class="title">手机号码</view>
					<input class="ipt" placeholder="请输入" name="input"></input>
				</view>
				<view class="cu-form-group">
					<view class="title">所在地区</view>
					<input class="ipt" placeholder="请输入" name="input" @tap="showPicker('region')" :value="result"></input>
					<text class='cuIcon-locationfill text-white'></text>
				</view>
				
				<view class="btn-wrrapper">
					<button class="cu-btn btn block radius bg-green" @click="noway">
						提交申请
					</button>
				</view>
			</form>
			
			<w-picker
				class="city"
				mode="region"
				:value="defaultRegion"
				default-type="value"
				:hide-area="false"
				@confirm="onConfirm($event,'region')"
				@cancel="onCancel"
				ref="region" 
			></w-picker>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: -1,
				picker: ['家庭工作站', '社区服务站', '城市运营中心'],
				defaultRegion:["150000","150100","150103"],
				result: '省-市-区',
				defaultChoice: false
			}
		},
		methods: {
			PickerChange(e) {
				this.index = e.detail.value
			},
			showPicker(type){
				this.$refs[type].show();
			},
			onConfirm(res,type){
				this.result=res.result;
				console.log(res)
			},
			switchDefault(e) {
				this.defaultChoice = e.detail.value
			},
			noway() {
				uni.showToast({
					title: '暂未开放，敬请期待。',
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrapper {
		color: #fff;
	}
	.city {
		color: black;
	}
	.uni-input-input {
		color: #fff !important;
	}
	
	.cu-form-group {
		background: #242644;
		border-color: #393C52;
		.title {
			width: 180rpx;
		}
		.ipt {
			color: #fff;
		}
		.picker {
			text-align: left;
		}
	}
	.btn-wrrapper {
		padding: 0 50rpx;
		.btn {
			background-color: #00D388;
			margin-top: 100rpx;
		}
	}	   
	uni-switch.green[checked] .wx-switch-input, uni-switch[checked] .wx-switch-input, uni-checkbox.green[checked] .wx-checkbox-input, uni-checkbox[checked] .wx-checkbox-input, uni-radio.green[checked] .wx-radio-input, uni-radio[checked] .wx-radio-input, uni-switch.green.checked .uni-switch-input, uni-switch.checked .uni-switch-input, uni-checkbox.green.checked .uni-checkbox-input, uni-checkbox.checked .uni-checkbox-input, uni-radio.green.checked .uni-radio-input, uni-radio.checked .uni-radio-input {
		background-color: #00D388 !important;
		border-color: #00D388 !important;
		color: #ffffff !important;
		border-color: #39B54A !important;
	}
</style>
